// 这里是 解释器 trait 的定义处

use crate::lexing;

pub trait Lox {
    /// 执行一条语句
    fn eval(&mut self, code: &str);

    /// 报告错误
    fn report_error(&self) {
        todo!()
    }
}

// tree walk lox
pub struct TLox {}

impl TLox {
    pub fn new() -> Self {
        TLox {}
    }
}

impl Lox for TLox {
    fn eval(&mut self, code: &str) {
        let mut scanner = lexing::Scanner::new(code);
        scanner.scan();
        println!("{:?}", scanner.tokens());
    }
}
